<template>
    <div>
        
         <table border="1" width="200" height="100">
            <tr>
                
                <th>
                    名称
                </th>
                
            </tr>
            <tr >
                <td><input type="text" v-model="cname"></td>
                

            </tr>
        </table>

        <br><br>

        <Button @click="submit">提交</Button>
    </div>
</template>




<script>
export default {
    data(){
        return{
            cid:this.$route.query.cid,
            cname:''
        }
    },

    mounted(){
        this.axios.get('http://localhost:8000/addcate/',{params:{cid:this.cid}}).then((res)=>{
            console.log(res)
            this.cname = res.data.data
        })
    },

    methods:{
        //提交
        submit(){
            this.axios.put('http://localhost:8000/addcate/',{cid:this.cid,cname:this.cname}).then((res)=>{
            console.log(res)
            this.$Message(res.data.message)
            this.$router.push('/myeditcategory')
            
        })
        }
    }


}
</script>